<?php
define('WB_TTYPE_T_IN', '疏港'); // 集卡进口
define('WB_TTYPE_T_OUT', '集港'); // 集卡出口
define('WB_TTYPE_ZC', '整车'); // 整车
define('WB_TTYPE_LD', '零担'); // 零担
define('WB_TTYPE_CP', '城配'); // 城配
class WaybillModel extends BaseModel
{
    var $table  = 'waybill_main';
    var $prikey = 'wm_tid';
    var $_name  = 'waybill';
    
var $_relation  = array(

        
        'has_trunk' => array(
            'model'         => 'waybilltrunk',
            'type'          => HAS_MANY,
            'foreign_key'   => 'ws_wmtid',
            'dependent'     => true
        ),
        // 一个运单有多个监控
        'has_normal' => array(
            'model'         => 'waybillnormal',
            'type'          => HAS_MANY,
            'foreign_key'   => 'ws_wmtid',
            'dependent'     => true
        ),
        // 一个运单有多个运程
        'has_haul' => array(
            'model'         => 'haul',
            'type'          => HAS_MANY,
            'foreign_key'   => 'h_wmtid',
            'dependent'     => true
        ),
        // 一个运单有多个监控
        'has_monitor' => array(
            'model'         => 'monitor',
            'type'          => HAS_MANY,
            'foreign_key'   => 'm_zmmtid',
            'dependent'     => true
        ),
        'belongs_to_user' => array(
            'model'         => 'member',
            'type'          => BELONGS_TO,
            'foreign_key'   => 'user_id',
            'reverse'       => 'has_will',
        ),
    );

}
?>